package com.lesson01;

public class StacticProxy {
    public static void main(String[] args) {
        you y = new you();

        new Thread(()->System.out.println("线程执行")).start();
        new WeddingCompany(y).HappyMarry();
        //代理模式
        WeddingCompany company = new WeddingCompany(y);
        company.HappyMarry();
    }
}
interface Marry {
    void HappyMarry();
}
class you implements Marry{

    @Override
    public void HappyMarry() {
        System.out.println("结婚");
    }
}
class WeddingCompany implements Marry{
    private Marry target;
    public WeddingCompany(Marry target) {
        this.target = target;
    }
    @Override
    public void HappyMarry() {
        before();
        target.HappyMarry();//真实对象
        after();
    }

    private void before() {
        System.out.println("布置婚礼现场");
    }
    private void after() {
        System.out.println("婚礼之后收尾");
    }
}